function grtUserInfo() {
  $.ajax({
    url: "/my/user/userinfo",
    success: function (res) {
      if (res.status === 0) {
        // console.log(res);
        var name = res.data.nickname || res.data.username;
        $('.username').text(name);
        if (res.data.user_pic) {
          $('.layui-nav-img').attr('scr', res.data.user_pic).show()
          $('user-avatar').hide();
        } else {
          var first = name.substr(0, 1).toUpperCase();
          $('.use-avatar').text(first).css('display', 'inline-black')
        }
      }

    },
    complete: function (xhr) {

        console.log(xhr);

    }
  })
}
grtUserInfo()






$('#logout').on('click', function (e) {
  e.preventDefault();
  layer.confirm('is not?', { icon: 3, title: '提示' }, function (index) {
    //do something
    localStorage.removeItem('token')
    location.href = "./login.js"
    layer.close(index);
  });
})